package entity.controller;

import java.util.List;
import java.util.Map;

import javax.ejb.Local;
import javax.persistence.EntityManager;

import entity.base.BaseEntity;

@Local
public interface BaseEntityController {
	
	public EntityManager getEntityManager();
	
	public void delete(BaseEntity entity);
	
	public BaseEntity save(BaseEntity entity);
	
	public BaseEntity getById(Class<? extends BaseEntity> clazz, String id);
	
	public List<? extends BaseEntity> getList(Class<? extends BaseEntity> clazz);
	
	public List<? extends BaseEntity> getOrderedList(Class<? extends BaseEntity> clazz, String orderField);
	
	public List<? extends BaseEntity> getPaginatedList(Class<? extends BaseEntity> clazz, int start, int end);
	
	public List<? extends BaseEntity> getPaginatedOrderedList(Class<? extends BaseEntity> clazz, int start, int end,
			String orderField);
	
	public List<? extends BaseEntity> getPaginatedOrderedFilteredList(Class<? extends BaseEntity> clazz, int start,
			int end, String orderField, Map<String, String> filters);
	
	public List<? extends BaseEntity> search(Class<? extends BaseEntity> clazz, String key);
	
	public List<? extends BaseEntity> paginatedSearch(Class<? extends BaseEntity> clazz, String key, int start, int end);
	
	public BaseEntity getByField(Class<? extends BaseEntity> clazz, String field, String id);
	
	public List<BaseEntity> saveBatch(List<BaseEntity> entityList);
	
}
